calculate trees using machine learning